<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"> 

<body> 
   <h:form id="rechForm">
   
     <p:messages />
     
     <p:panel id="infosPanel" toggleable="true" styleClass="panelForm" 
              header="#{msg['rechercher.candidat.form.title']}">
	          <br />
		      <p:panelGrid id="infosGrid" columns="4" >

                  <h:outputText  value="#{msg['candidat.nom']}" />
                  <h:column>
		            <p:inputText  id="nom" required="false" 
		                          requiredMessage="#{msg['data.required']}" 
		                          value="#{candidatController.candidat.nom}"></p:inputText>
		            <p:message for="nom" showDetail="false" showSummary="true" /> 
                  </h:column>
                  
		         <h:outputText  value="#{msg['candidat.cin']}" />
		          <h:column>
		            <p:inputText id="cin" required="false" value="#{candidatController.candidat.cin}"></p:inputText>
		          </h:column>
		          
		          <h:outputText  value="#{msg['candidat.prenom']}" />
		          <h:column>
		            <p:inputText id="prenom" required="false" value="#{candidatController.candidat.prenom}"></p:inputText>
		          </h:column>
		          
		         <h:outputText  value="#{msg['candidat.phone']}" />
		         <h:column>
		           <p:inputText id="phone" required="false" value="#{candidatController.candidat.numTele}"></p:inputText>
		         </h:column>
   
		      </p:panelGrid>
 			  <br />
		      <f:facet name="footer">
		   
			      <p:commandButton value="Rechercher" id="saveBtn" icon="ui-icon-check" 
			                       action="#{candidatController.rechercherCandidats}" update="infosGrid, :resultsForm" />
			                       
			       <p:commandButton value="Initialiser" styleClass="buttonRight" id="resetBtn" icon="ui-icon-refresh" 
			                        action="#{candidatController.initRecherche}" update="infosGrid, :resultsForm" />
		      </f:facet>

    
	</p:panel>
	
	<p:blockUI block="infosPanel" trigger="saveBtn">  
        Loading...<br />  
        <p:graphicImage  value="#{msg['images.loading.path']}"/>  
    </p:blockUI>
   </h:form>
   
   <h:form id="resultsForm">
     <p:outputPanel id="dataCandidats" rendered="#{not empty candidatController.listCandidats}">
     <p:separator></p:separator>
            <p:dataTable styleClass="tableResults" var="condidat" value="#{candidatController.listCandidats}">
		        <p:column sortBy="#{condidat.nom}" headerText="#{msg['candidat.nom']}">
		            <h:outputText value="#{condidat.nom}" />
		        </p:column>
		
		        <p:column headerText="#{msg['candidat.prenom']}">
		            <h:outputText value="#{condidat.prenom}" />
		        </p:column>
		        
		        <p:column headerText="#{msg['candidat.cin']}">
		            <h:outputText value="#{condidat.cin}" />
		        </p:column>
		        
		        <p:column headerText="#{msg['candidat.phone']}">
		            <h:outputText value="#{condidat.numTele}" />
		        </p:column>
		    </p:dataTable>
     </p:outputPanel>
   </h:form>
   
</body> 
</html>
